import React from 'react'
import { Image,Button,Toast } from 'antd-mobile'
import Daohang from '../../hook/Index'
import { useNavigate } from 'react-router-dom'
const Index = () => {
  const avatar=localStorage.getItem('avator')
  const nickname=localStorage.getItem('name')
  let navigate=useNavigate()
  const goout=()=>{
    localStorage.clear()
    navigate('/login')
    Toast.show({
      icon: "success",
      content: "退出成功",
    });
  }
  return (
    <div>
      <Image
            src={avatar}
            width={64}
            height={64}
            fit='cover'
            style={{ borderRadius: 4 }}
          />
          <div>{nickname}</div>
          <Button block color='danger' size='large' onClick={goout}>
          退出
        </Button>
    </div>
  )
}

export default Daohang(Index)
